package com.crud.project.service;

import com.crud.project.dao.IResourceDao;
import com.crud.project.po.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResourceService implements IResourceDao {
    @Autowired
    private IResourceDao iResourceDao;
    @Override
    public List<Resource> findAllResource() {
        List<Resource> resourceList=iResourceDao.findAllResource();
        return resourceList;
    }

    @Override
    public void insertResource(Resource resource) {
        iResourceDao.insertResource(resource);
    }

    @Override
    public void insertCourse_resourse(Long course_id, Long resource_id) {
        iResourceDao.insertCourse_resourse(course_id,resource_id);
    }

    @Override
    public String findResourceIdByResource(Resource resource) {
        String resource_id=iResourceDao.findResourceIdByResource(resource);
        return  resource_id;
    }

    @Override
    public Resource findResourceById(Long id) {
        Resource resource=iResourceDao.findResourceById(id);
        return resource;
    }

    @Override
    public List<String> findResource_courseId(Long id) {
        List<String> longList=iResourceDao.findResource_courseId(id);
        return longList;

    }

    @Override
    public void deleteResource_course(Long id) {
        iResourceDao.deleteResource_course(id);
    }

    @Override
    public void updateResource(Resource resource) {
        iResourceDao.updateResource(resource);
    }

    @Override
    public void deleteResourceById(Long id) {
        iResourceDao.deleteResourceById(id);
    }
}
